<@t.html>
	<@t.container title="发送邮件" icon="send" >
				<@t.form id="add_form">
					<#if bean??>
        				<input type="hidden" id="id" name="id" value="${bean.id}"/>	
					</#if>
					<@t.text title="收件人名称" id="to_name" value="${bean.to_name!''}" />    
					<@t.text title="收件箱" id="to_mail" value="${bean.to_mail!''}" />    
                	<@t.text title="标题" id="title" value="${bean.title!''}" />
                	<@t.editor title="内容" id="content" value="${bean.content!''}" />
                	<@t.uploader title="附件" id="attachment" value="${bean.attachment!''}" />
					<@t.submitBtn/>
               </@t.form>
	</@t.container>
	<!-- 加载百度编辑器最小版本 -->
	<script type="text/javascript" src="public/common/ueditor/ueditor.config.js"></script>
	<script type="text/javascript" src="public/common/ueditor/ueditor.all.min.js"></script>
	<script type="text/javascript">
     $(function(){
    	 $("#attachment").uploadify({params:{"channel":"normal_other"},fileTypeExts:'*.*',uploadLimit:5,multi:true});
		//提交表单
       	  $('#add_form').validator({
        		theme: 'yellow_right_effect',  //设置theme
        		stopOnError: true, //
        		showOk:false,
        	    fields: {
        	        "title": {
        	            rule: "required;",
        	            ok: "",
        	            tip:"请填写标题",
        	            msg: {
        	            	required: "标题不可以为空!",
        	            }
        	        },
        	        "to_mail": {
        	            rule: "required;email",
        	            ok: "",
        	            tip:"请填写电子邮箱",
        	            msg: {
        	            	required: "电子邮箱不可以为空!",
        	            }
        	        },
        	        "content": {
        	            rule: "required",
        	            ok: "",
        	            tip:"请填写内容",
        	            msg: {
        	            	required: "内容不可以为空!",
        	            }
        	        }
        	    }
        	});
		  $('#add_form').on('valid.form', function(e, form){
		  	   //成功之后刷新gd，关闭自己
			   var data=$(this).serialize();
				//提交表单
               $ .axsf('admin/mail_record/send',data,function(d){
			   		if(d){
                         if(d.code==200){
						 	alert("邮件任务推送成功，请稍候查看...");
							window.location.href="admin/mail_record/index";
                         }else{
						 	alert(d.message);
						 }
                	}
			   });
        });
});
    </script>
</@t.html>